package com.bocai.freeman.view.adapter;

import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.trello.rxlifecycle.components.support.RxFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by win7 on 2016/3/28.
 */
public class VpAdapter extends FragmentPagerAdapter {

    private final List<RxFragment> mFragments = new ArrayList<>();

    public VpAdapter(FragmentManager fm) {
        super(fm);
    }

    public void addFragment(RxFragment fragment) {
        mFragments.add(fragment);
    }

    @Override
    public RxFragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        return mFragments.size();
    }
}
